<?php
	require_once ('config/connection.php');
	/*//$data=simplexml_load_file("../assets/data/Data.xml");
     //   mysql_connect("localhost", "root", "");
      //  mysql_select_db("autogator_demo");
         
     echo  $query = "SELECT vehicle_id FROM vehicle";
      $result = mysql_query($query) or die("MYSQL ERROR");
     
     
      while($row = mysql_fetch_array($result))
      {
          
        echo   $query = "INSERT INTO vehicle_autogator (vehicle_id,role_id,create_date,created_by) VALUES(".$row['vehicle_id'].",3,NOW(),2)";
          mysql_query($query) or die("MYSQL ERROR". $query);
      }*/
        
  //***CREATE COMPANY ALIAS****//      
/*$result = mysql_query("SELECT id, company_name FROM company");
while($row = mysql_fetch_array($result))
{
    echo $query = "UPDATE company SET company_alias ='".strtolower(preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', $row["company_name"]))."' WHERE id=".$row['id'];
    mysql_query($query)or die("MYSQL ERROR");
}
//echo strtolower(preg_replace('/[^a-zA-Z0-9_%\[().\]\\/-]/s', '', "K & S Towing"));
 * 
 * 
 * 
 */
          //***CREATE COMPANY MAPING TABLES****//
        
       /* $query = "SELECT id, company_alias, company_type FROM company WHERE company_type='Tower company'";
        $result = mysql_query($query);
        while($row = mysql_fetch_array($result))
        {
           // mysql_query("CREATE TABLE ".$row["company_alias"]."_vehicle (vehicle_id INT, role_id INT, create_date DATETIME, created_by INT, update_date DATETIME, updated_by INT)") or die("MYSQL ERROR: ON CREATINF MAPPING TABLE");
            $query = "SELECT vehicle_id FROM vehicle WHERE delivery=".$row["id"];
            $result_del = mysql_query($query);
            while($del_row = mysql_fetch_array($result_del))
            {
               
                $query ="INSERT INTO ".$row["company_alias"]."_vehicle (vehicle_id, role_id, create_date, created_by) VALUES(".$del_row['vehicle_id'].", 8, NOW(),2 )";
               mysql_query($query) or die("MYSQL ERROR: ON INSERTING MAPPING TABLE".$query);
            }
        }*/
     
?>